<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<link type="text/css" href="/css/start/jquery-ui-1.8.21.custom.css" rel="Stylesheet" />	
<style type="text/css">
/* <![CDATA[ */

table, td
{
    border-color: #666;
    border-style: solid;
}
table, th
{
    border-color: #666;
    border-style: solid;
}

table
{
    border-width: 0 0 1px 1px;
    border-spacing: 0;
    border-collapse: collapse;
}
 
td
{
    margin: 0;
    padding: 4px;
    border-width: 1px 1px 0 0;
}
th
{
    margin: 0;
    padding: 4px;
    border-width: 1px 1px 0 0;
}

/* ]]> */
</style>

<style type="text/css">
.noborder{
	border-top-width:0px;
	border-bottom-width:0px;
	
	}
.withborder{
	border-top-width:1px;
	border-bottom-width:0px;
	}	
#lean_overlay {
    position: fixed;
    z-index:100;
    top: 0px;
    left: 0px;
    height:100%;
    width:100%;
    background: #000;
    display: none;
} 

.btn_act{

    width: 600px;
    padding-bottom: 2px; 
	display:none;
	background: #FFF;
    border-radius: 5px; -moz-border-radius: 5px; -webkit-border-radius: 5px;
    box-shadow: 0px 0px 4px rgba(0,0,0,0.7); -webkit-box-shadow: 0 0 4px rgba(0,0,0,0.7); -moz-box-shadow: 0 0px 4px rgba(0,0,0,0.7);      
}
.btn_edit{

    width: 900px;
    padding-bottom: 2px;
    padding-left:50px; 
	display:none;
	background: #FFF;
    border-radius: 5px; -moz-border-radius: 5px; -webkit-border-radius: 5px;
    box-shadow: 0px 0px 4px rgba(0,0,0,0.7); -webkit-box-shadow: 0 0 4px rgba(0,0,0,0.7); -moz-box-shadow: 0 0px 4px rgba(0,0,0,0.7);      
}
.btn_com{

    width: 600px;
    padding-bottom: 2px; 
	display:none;
	background: #FFF;
    border-radius: 5px; -moz-border-radius: 5px; -webkit-border-radius: 5px;
    box-shadow: 0px 0px 4px rgba(0,0,0,0.7); -webkit-box-shadow: 0 0 4px rgba(0,0,0,0.7); -moz-box-shadow: 0 0px 4px rgba(0,0,0,0.7);      
}
.btn_delete{

    width: 600px;
    padding-bottom: 2px; 
	display:none;
	background: #FFF;
    border-radius: 5px; -moz-border-radius: 5px; -webkit-border-radius: 5px;
    box-shadow: 0px 0px 4px rgba(0,0,0,0.7); -webkit-box-shadow: 0 0 4px rgba(0,0,0,0.7); -moz-box-shadow: 0 0px 4px rgba(0,0,0,0.7);      
}
#payrollWizard{
	position:relative;
	top:5px;
    left:85%;
}
html, body {
height: 100%;
width: 100%;
}

.close {
float:right;
clear:both;
width:100%;
text-align:right;
margin:0 0 6px 0
}
.close a {
color:#333;
text-decoration:none;
font-size:14px;
font-weight:700
}
.con {
text-indent:20px;
line-height:10px;
}
</style>
<script type="text/javascript" src="/js/jquery-1.7.2.min.js"></script>
<script type="text/javascript" src="/js/jquery-ui-1.8.21.custom.min.js"></script>
<script type="text/javascript" src="/js/jquery.leanModal.min.js"></script>

<script language="javascript"> 
function toggle(str,str2) {
	var ele = document.getElementById(str);
	var text = document.getElementById(str2);
	if(ele.style.display == "") {
    		ele.style.display = "none";
			text.innerHTML = "Show";
  	}
	else {
		ele.style.display = "";
		text.innerHTML = "Hide";
	}
}
function toggle2(str,str2,str3) {
	var ele = document.getElementById(str);
	var text = document.getElementById(str2);
	if(ele.style.display == "") {
    		ele.style.display = "none";
    		text.innerHTML = str3;
  	}
	else {
		ele.style.display = "";
		text.innerHTML = "Hide";
	}
} 
function transfer(date_begin,date_end){
	window.location.href = 'http://<?php echo WEB_IP?>/rosteraudit/payroll-wizard-export-sheet/date_begin/'+ date_begin + '/date_end/' + date_end + '/next/yes';
}

function ischeck(){

	var staffName = $("#staff_name").val();
	if(staffName.length >= 2){
		$("#btn_activation").prop('disabled', false);
	}else{
		$("#btn_activation").prop('disabled', true);
	}
	
}

function allocateTime(source){

	var id = $(source).attr('id');
	var abc = id.split("_");

	var total = parseFloat($('#total_short_hr_'+abc['2']).attr('value'));
	var nrm = parseFloat($('#normal_hour_'+abc['2']).attr('value'));
	var pm = parseFloat($('#pm6_hour_'+abc['2']).attr('value'));
	var satH = parseFloat($('#saturday_hour_'+abc['2']).attr('value'));
	var sunH = parseFloat($('#sunday_hour_'+abc['2']).attr('value'));
	var holiH = parseFloat($('#holiday_hour_'+abc['2']).attr('value'));

	var Th = (nrm + pm + satH + sunH + holiH).toFixed(2);
	if(Th <= total){
		$("#btn_activation_"+abc['2']).prop('disabled', false);
	}else{
		$("#btn_activation_"+abc['2']).prop('disabled', true);
	}
	
}


function totalCheck(source){
	var id = $(source).attr('id');
	var nrm = parseFloat($(source).attr('value'));
	var abc = id.split("_");
	var total = parseFloat($('#total_short_hr_'+abc['2']).attr('value'));
	if(nrm > total){
		$("#btn_activation_"+abc['2']).prop('disabled', true);
	}else{
		$("#btn_activation_"+abc['2']).prop('disabled', false);
	}
	
}
</script>

<script type="text/javascript">
			$(function() {
    			$('a[rel*=leanModal]').leanModal({ top : 200, closeButton: ".modal_close" });		
			});
		</script>

<script>
	$(function() {

		$( "#begin_date" ).datepicker({ dateFormat: "yy-mm-dd",firstDay: 1 });
		$( "#finish_date" ).datepicker({ dateFormat: "yy-mm-dd",firstDay: 1 });
		$( "#begin_date2" ).datepicker({ dateFormat: "yy-mm-dd",firstDay: 1 });
		$( "#finish_date2" ).datepicker({ dateFormat: "yy-mm-dd",firstDay: 1 });
		$( ".date" ).datepicker({ dateFormat: "yy-mm-dd",firstDay: 1 });
		
	});


</script>

</head>

<body style="font-family:Arial, Helvetica, sans-serif">

<h1>Account Payroll Case Control</h1><br/>
<h2>Payroll cycle (<?php echo $this->dateStart;?> - <?php echo $this->dateEnd;?>)</h2><br/>
<hr width=100% size=1></hr>
<?php //var_dump($this->openCase);

$ts = new Model_DbTable_Roster_Timesheet();
$attd = new Model_DbTable_Roster_Attnrecord();
$attCaseRecord = new Model_DbTable_Roster_Attcaserecord();

$stDetail = new Model_DbTable_Roster_Stafflogindetail();
$dateToday = Model_DatetimeHelper::dateToday('');
$date2MonthAgo = Model_DatetimeHelper::adjustDays('sub', $dateToday, 60);


?>
<h2>Opening Case</h2>
Calculator:<br />
<br />
<b><i>From :</i></b>
<input name="cald_start_hour" type="text" id="cald_start_hour" style="width:50px" /><b>:</b><input name="cald_start_min" type="text" id="cald_start_min" style="width:50px" />
<b><i>To</i></b>
<input name="cald_end_hour" type="text" id="cald_end_hour" style="width:50px;" /><b>:</b><input name="cald_end_min" type="text" id="cald_end_min" style="width:50px;" /><b> = </b><input name="calh_total_hour" type="text" id="calh_total_hour" style="width:50px;" />
<i>(hrs)</i> <b> + </b>  
<input name="calh_hour_2" type="text" id="calh_hour_2" style="width:50px;" />
<i>(hrs)</i>  <b> = </b>
 <input name="calh_hour_sum" type="text" id="calh_hour_sum" style="width:50px;" />
<i>(hrs)</i>
 <br />
<a href = "http://<?php echo WEB_IP?>/products/online-invoice-list-wh" target= "_blank" >Check Invoice</a>
 <br />
 <br />
<table width="1500" border="1" cellspacing="1" cellpadding="0" style="font-size:13px;">
  <tr>
    <th rowspan="2" scope="col">Case ID</th>
    <th rowspan="2" scope="col">Shop</th>
    <th rowspan="2" scope="col">Manager</th>
    <th rowspan="2" scope="col">Staff</th>
    <th rowspan="2" scope="col">Type</th>
    <th rowspan="2" scope="col">Date</th>
    <th colspan="3" rowspan="2" scope="col">System Record</th>
    <th colspan="2" rowspan="2" scope="col">Propose Record</th>
    <th rowspan="2" scope="col">Bk</th>
    <th rowspan="2" scope="col">Problem</th>
    <th rowspan="2" scope="col">Propose Hrs</th>
    <th rowspan="2" scope="col">Will Pay Hrs</th>
    <th rowspan="2" scope="col">Short Hrs</th>
    <th colspan="2" scope="col">Evidence</th>
    <th colspan="3" scope="col">Status</th>
    <th rowspan="2" scope="col">Detail</th>
    <th rowspan="2" scope="col" style="width:150px;">Action</th>
  </tr>
  <tr>
    <th scope="col">On Duty</th>
    <th scope="col">Off Duty</th>
    <th scope="col">Create</th>
    <th scope="col">Request</th>
    <th scope="col">Provided</th>
  </tr>
  
<?php 
if(!empty($this->openCase)){
foreach($this->openCase as $k => $v) {
	
	date_default_timezone_set("Australia/Melbourne");
	
	if($v['shop_code']=="ADPC" || $v['shop_code']=="CLPC" || $v['shop_code']=="CLIC" || $v['shop_code']=="WLIC"){

		date_default_timezone_set("Australia/Adelaide");
	}
	
	$sysShiftStart = " - ";
	$sysShiftEnd = " - ";
	$attOnDuty = " - ";
	$attOffDuty = " - ";
	
	//check case self case  or 
	//if(substr($v['case_id_case'],0,2) == "CA"){
if(1){
		$tsRow = $ts->listShiftByStaffIdByDateByShop($v['id_staff'], $v['shop_code'],$v['shift_date'],$v['shift_date']);
		$attRow = $attd->getFirstOnLastOffDuty($v['id_staff'],$v['shift_date'],Model_EncryptHelper::sslPassword($v['shop_code']));
		
		//var_dump($tsRow,$attRow);
	}	
	?>  
  <tr>
    <td rowspan="2" <?php if($v['shift_date']>= $this->dateStart && $v['shift_date'] <= $this->dateEnd){?>style=" background-color:#2FF20D;" <?php }?>><?php echo $v['case_id_case']?></td>
    <td rowspan="2"><?php echo $v['shop_code']?></td>
    <td rowspan="2"><?php 
    $mgrDetail = $stDetail->getDetail($v['id_manager']);
    echo ($mgrDetail['ni']=="")?Model_EncryptHelper::getSslpassword($mgrDetail['n']):$mgrDetail['ni'];
    ?></td>
    <td rowspan="2"><?php 
    $mgrDetail = $stDetail->getDetail($v['id_staff']);
	echo ucwords(Model_EncryptHelper::getSslpassword($mgrDetail['n']));
	echo " <br />[";
	echo ucwords(($mgrDetail['ni']=="")?Model_EncryptHelper::getSslpassword($mgrDetail['n']):$mgrDetail['ni']);
	echo " ]";
    
    ?></td>
    <?php $staffInfo = new Model_DbTable_Roster_Staffinfo();
    	  $staffPackage = $staffInfo->getStaffinfo($v['id_staff']);
    	  $package = $recShopList = unserialize(PAYROLL_TYPE);?>
    <td rowspan="2" <?php if($staffPackage['id_package']) {}else{?>style=" background-color:red;"<?php }?>><?php if($staffPackage['id_package']) {echo $package[$staffPackage['id_package']][0];}else{ echo 'Null';}?></td>
    <td rowspan="2" ><?php echo $v['shift_date']?></td>
    <td>SFT:</td>
    <td><?php echo date("H:i",$tsRow['confirm_shift_begin']) ?></td>
    <td><?php echo date("H:i",$tsRow['confirm_shift_end']) ?></td>

    <td rowspan="2"><?php echo str_pad($v['man_shift_begin_hour'],2,"0",STR_PAD_LEFT); ?> : <?php echo  str_pad($v['man_shift_begin_min'],2,"0",STR_PAD_LEFT); ?> </td>
    <td rowspan="2"><?php echo str_pad($v['man_shift_end_hour'],2,"0",STR_PAD_LEFT);?> : <?php echo str_pad($v['man_shift_end_min'],2,"0",STR_PAD_LEFT);?> </td>

    <td rowspan="2">F:<?php echo $v['break_first_min']."<br/>"?> S: <?php echo $v['break_second_min']?> </td>
    <td rowspan="2">
    <?php 
    
    // 1. WRONG SHIFT 
    if( (int) date("H",$tsRow['confirm_shift_begin'])!= (int)$v['man_shift_begin_hour'] ||
    	(int) date("i",$tsRow['confirm_shift_begin'])!= (int)$v['man_shift_begin_min'] ||
    	(int) date("H",$tsRow['confirm_shift_end'])!= (int)$v['man_shift_end_hour'] ||
    	(int) date("i",$tsRow['confirm_shift_end'])!= (int)$v['man_shift_end_min']
    ){
    	
    	echo 'WRONG SHIFT<br />';
    }
    
    // 2. MISSING ATTN
    if( $attRow[0]=="" || $attRow[1]=="" 
    ){
    	echo 'MISSING RECORD<br />';
    }		
    
    ?>
    </td>
    <td rowspan="2"><?php echo $v['hour_request']?></td>
    <td rowspan="2"><?php echo $v['hour_allocate']?></td>
    <td rowspan="2"><?php echo $v['hour_request'] - $v['hour_allocate'] ?></td>
    <td>F:<?php echo ($v['link_image_open'])?'<a href="'.$v["link_image_open"].'" target="_blank">View</a>':' - ';?></td>
    <td>F:<?php echo ($v['link_image_close'])?'<a href="'.$v["link_image_close"].'" target="_blank">View</a>':' - ';?></td>
    <td rowspan="2" align="center">
    <?php
    $lastStatus = $attCaseRecord->lastStatus($v['id_case']);
	if($lastStatus['id_status'] == 1){ echo '<img src="/im/ind_new.png" border="0" />'; }
	?>
    </td>
    <td rowspan="2" align="center"><?php
    if($lastStatus['id_status'] == 4){ echo '<img src="/im/ind_req.png" border="0" />'; }
	?></td>
    <td rowspan="2" align="center">
    <?php
    if($lastStatus['id_status'] == 5){ echo '<img src="/im/ind_prv.png" border="0" />'; }
	?>
    </td>
    <td rowspan="2">[<a id="txt<?=$v["id_case"]?>" href="javascript:toggle('dT<?=$v["id_case"]?>','txt<?=$v["id_case"]?>');">Show</a>]</td>
    <td rowspan="2"><table width="100%" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td>
    <a id="go" rel="leanModal" name="request" href="#btn_req<?=$v["id_case"]?>">Request</a>
        <div id="btn_req<?=$v["id_case"]?>" class="btn_act">        
		<div style=" background-color:#97C0FF; display:block">
		<span style="float:left">Request more information</span> <span style="float:right;"><a class="modal_close" href="#">[ X ]</a></span><br />
		</div>
        <div style="background-color:#EEE; display:block"><br />

        <form action="/rosteraudit/payroll-save-request" method="post">
        <input type="hidden" name="start_date" id="start_date" value="<?php echo $this->dateStart;?>" />
   		<input type="hidden" name="end_date" id = "end_date" value="<?php echo $this->dateEnd;?>" />
        Request more information regarding this case <br /><br />
		Input Head Office Staff Name:  <input name="staff_name" type="text" /> <br /><br />

        Reason/Comment For Request More Info:<br /> 
		<textarea name="comment" style="width:80%" rows="2"></textarea><br />

        <input type="hidden" name="id_case" value="<?=$v["id_case"]?>" />
		
        <input name="btn_request" type="submit" value="Send Request" />
        </form>
        <br />
        </div>
</div>
    </td>
    <td>
     <a id="go" rel="leanModal" name="request" href="#btn_acc<?=$v["id_case"]?>">Accept</a>
        <div id="btn_acc<?=$v["id_case"]?>" class="btn_edit">        
		<div style=" background-color:#97C0FF; display:block">
		<span style="float:left">ACCEPT</span> <span style="float:right;"><a class="modal_close" href="#">[ X ]</a></span><br />
		</div>
        <div style="background-color:#EEE; display:block; padding:"><br />

        <form action="/rosteraudit/payroll-save-accept" method="post">
        <?php if($staffPackage['id_package'] != 2 && $staffPackage['id_package'] != 3 && $staffPackage['id_package'] != 4 && $staffPackage['id_package'] != 7){?>
        <input type="hidden" name="start_date" value="<?php echo $this->dateStart;?>" />
   		<input type="hidden" name="end_date"   value="<?php echo $this->dateEnd;?>" />
   		<input type="hidden" name="shift_date" value="<?php echo $v['shift_date'];?>" />
    	<?php echo "Payment Type:".$package[$staffPackage['id_package']][0]?><br /><br />

		Input Head Office Staff Name: <input name="staff_name" type="text" id = "staff_name" onchange = "ischeck()"/> <br /><br />
		
        I will process the payment on: <input name="date_will_pay" type="text" id="date_will_pay<?=$v["id_case"]?>" class = "date" value="" /><br /><br />
        Max Manager Propose Hour: <input type = "text" id = "total_short_hr_<?=$v["id_case"]?>" value = "<?php echo $v['hour_request'] - $v['hour_allocate'] ?>" size = "2px" readonly></input><br/><br/>
          <table width="200" border="1" cellspacing="0" cellpadding="2">
        <tr>
    	<td rowspan="2">Actual Allocate Hours</td>
    	<td>Normal Hours</td>
  		</tr>
  		<tr>
    	 <td><input name="normal_hour" id="normal_hour_<?=$v["id_case"]?>" type="text"  value="<?php echo $v['hour_request'] - $v['hour_allocate'] ?>" onchange = "totalCheck(this)"/> <input name="pm6_hour" id="pm6_hour<?=$v["id_case"]?>" type="hidden"  value="0" />
    	 <input name="saturday_hour" id="saturday_hour_<?=$v["id_case"]?>" type="hidden"  value="0" />
    	 <input name="sunday_hour" id="sunday_hour_<?=$v["id_case"]?>" type="hidden"  value="0" />
   		 <input name="holiday_hour" id="holiday_hour_<?=$v["id_case"]?>" type="hidden"  value="0" /> </td>
    	
  		</tr>
		</table>
        <input type="hidden" name="id_case" value="<?=$v["id_case"]?>" />
		<br/>
      	 <input name="btn_activation" type="submit" id="btn_activation_<?=$v["id_case"]?>" value="Accept It!" />
        <?php }else{?>
        <input type="hidden" name="start_date" id="start_date" value="<?php echo $this->dateStart;?>" />
   		<input type="hidden" name="end_date" id = "end_date" value="<?php echo $this->dateEnd;?>" />
   		<input type="hidden" name="shift_date" value="<?php echo $v['shift_date'];?>" />
    	<?php echo "Payment Type:".$package[$staffPackage['id_package']][0]?><br /><br />

		Input Head Office Staff Name: <input name="staff_name" type="text" id = "staff_name" onchange = "ischeck()"/> <br /><br />
		
        I will process the payment on: <input name="date_will_pay" type="text" id="date_will_pay<?=$v["id_case"]?>" class = "date" value="" /><br /><br />
        Total Short Hour: <input type = "text" id = "total_short_hr_<?=$v["id_case"]?>" value = "<?php echo $v['hour_request'] - $v['hour_allocate'] ?>" size = "2px" readonly></input><br/><br/>
        <table width="800" border="1" cellspacing="0" cellpadding="2">
  <tr>
    <td rowspan="2">System Record</td>
    <td>Shift Begin</td>
    <td>Shift End</td>
    <td>Act Logon</td>
    <td>Act Logoff</td>
    <td>&nbsp;</td>
  </tr>
  <tr>
    <td><?php echo date("H:i",$tsRow['confirm_shift_begin']) ?></td>
    <td><?php echo date("H:i",$tsRow['confirm_shift_end']) ?></td>
    <td><?php echo ($attRow[0])?date("H:i",$attRow[0]): ' X ' ?></td> 
    <td><?php echo ($attRow[1])?date("H:i",$attRow[1]): ' X ' ?></td>
  	<td>&nbsp;</td>
  </tr>
  <tr>
    <td rowspan="2">Propose Record</td>
    <td colspan = "2">On Duty</td>
    <td colspan = "2">Off Duty</td>
  	<td>&nbsp;</td>
  </tr>
  <tr>
    <td colspan="2"><?php echo str_pad($v['man_shift_begin_hour'],2,"0",STR_PAD_LEFT); ?> : <?php echo  str_pad($v['man_shift_begin_min'],2,"0",STR_PAD_LEFT); ?> </td>
    <td colspan="2"><?php echo str_pad($v['man_shift_end_hour'],2,"0",STR_PAD_LEFT);?> : <?php echo str_pad($v['man_shift_end_min'],2,"0",STR_PAD_LEFT);?> </td>
  <td>&nbsp;</td>
  
  

    
  </tr>
  <tr>
  	<td align = "center" colspan = "6" ><span style = "color:red">Please Allocated Hour</span></td>
  </tr>
  <tr>
    <td rowspan="2">Short Hours</td>
    <td>Normal Hours</td>
    <td>After 6PM</td>
    <td>Saturday Hours</td>
    <td>Sunday Hours</td>
    <td>Holiday Hours</td>
  </tr>
  <tr>
    <td><input name="normal_hour" id="normal_hour_<?=$v["id_case"]?>" type="text"  value="0" onchange = "allocateTime(this)"/> </td>
    <td><input name="pm6_hour" id="pm6_hour_<?=$v["id_case"]?>" type="text"  value="0" onchange = "allocateTime(this)"/> </td>
    <td><input name="saturday_hour" id="saturday_hour_<?=$v["id_case"]?>" type="text"  value="0" onchange = "allocateTime(this)"/></td>
    <td><input name="sunday_hour" id="sunday_hour_<?=$v["id_case"]?>" type="text"  value="0" onchange = "allocateTime(this)"/></td>
    <td><input name="holiday_hour" id="holiday_hour_<?=$v["id_case"]?>" type="text"  value="0" onchange = "allocateTime(this)"/></td>
  </tr>
</table>

Comment / Detail
<textarea name="comment" style="width:80%" rows="2"></textarea><br />
        <input type="hidden" name="id_case" value="<?=$v["id_case"]?>" />
		
        <input name="btn_activation" type="submit" id="btn_activation_<?=$v["id_case"]?>" value="Accept It!"  disabled/>
        <?php }?>
        </form>
        <br />
        </div>
        
        
</div>
    
    
    </td>
    <td>
     <a id="go" rel="leanModal" name="request" href="#btn_rej<?=$v["id_case"]?>">Reject</a>
        <div id="btn_rej<?=$v["id_case"]?>" class="btn_com">        
		<div style=" background-color:#97C0FF; display:block">
		<span style="float:left">Rejection</span> <span style="float:right;"><a class="modal_close" href="#">[ X ]</a></span><br />
		</div>
        <div style="background-color:#EEE; display:block"><br />

        <form action="/rosteraudit/payroll-save-reject" method="post">
        <input type="hidden" name="start_date" id="start_date" value="<?php echo $this->dateStart;?>" />
   		<input type="hidden" name="end_date" id = "end_date" value="<?php echo $this->dateEnd;?>" />
        The Evidence provided is not good enough For me to make "Accept Case" Decision. <br /><br />
		There will be no more proofs,payment will NOT be processed.<br />
<br />

		Input Head Office Staff Name: <input name="staff_name" type="text" /> <br /><br />
		Reason / Comment Of Reject Case
		<textarea name="comment" style="width:80%" rows="2"></textarea><br />

        <input type="hidden" name="id_case" value="<?=$v["id_case"]?>" />
		
        <input name="btn_rej" type="submit" value="Reject It!" />
        </form>
        <br />
        </div>
</div>
    
    </td>
  </tr>
</table>
</td>
  </tr>
  <tr>
    <td>ACT:</td>
    <td><?php echo ($attRow[0])?date("H:i",$attRow[0]): ' X ' ?></td> 
    <td><?php echo ($attRow[1])?date("H:i",$attRow[1]): ' X ' ?></td>
    <td>IN:<?php if($v['offline_inv_on']){?><a href = "http://<?php echo SERVER_IP_COMM?>/products/online-invoice-public/shop/<?php echo $v['shop_code']?>/inv/<?php echo $v['offline_inv_on']?>" target="_blank"><?php echo $v['offline_inv_on']?></a><?php }else{echo ' - ';}?></td>
    <td>IN:<?php if($v['offline_inv_off']){?><a href = "http://<?php echo SERVER_IP_COMM?>/products/online-invoice-public/shop/<?php echo $v['shop_code']?>/inv/<?php echo $v['offline_inv_off']?>" target="_blank"><?php echo $v['offline_inv_off']?></a><?php }else{echo ' - ';}?></td>
  </tr>
<tr>
<td colspan="22" style="padding:0px;">
<div id="dT<?=$v["id_case"]?>" style="display:none;" >

<h3>Reasons Why can Not Provide Footage:</h3>
<div>
<?php echo $v['reason_comment']?>
</div>
<h3>Detail Explainations:</h3>
<div>
<?php echo $v['detail_explain']?>
</div>
<h3>Comment &amp; Conversion</h3>

------------------------------------------------------------------------------------------
<hr/>
<?php 


$recordList = $attCaseRecord->getCaseHistory($v["id_case"]);
?>

<table width="100%" border="0" cellspacing="0" cellpadding="0" style="border-width: 0px;">
  <?php foreach($recordList as $v3) { ?>
  <tr>
    <td style="background-color:#EFEFEF; ">
    <span style="width:50px;display:inline-block;margin-left:10px;">
    <?php
    switch($v3["id_status"]){
    	case(1):{
    		echo '<img src="/im/ind_new.png" border="0" />';break;}
    	case(4):{
    		echo '<img src="/im/ind_req.png" border="0" />';break;
    	}
    	case(5):{
    		echo '<img src="/im/ind_prv.png" border="0" />';break;
    	}
    	case(9):{
    		echo '<img src="/im/com_sm.png" border="0" />[MR]';break;
    	}
		case(10):{
    		echo '<img src="/im/com_sm.png" border="0" />[ADM]';break;
    	}		
    	case(80):{
    		echo '<img src="/im/ind_acc.png" border="0" />';break;
    	}
    	case(90):{
    		echo '<img src="/im/ind_rej.png" border="0" />';break;
    	}
    }
    ?>
    </span> -- On 
    <?=$v3["date_change"]?> -- <?=$v3["time_change"]?> -- By --<?=$v3["staff_name"]?>
    </td>
  </tr>
  <tr style="background-color:#FEFEFE; ">
    <td style="padding-left:20px;"><?php if($v3["comment"]!= null){echo nl2br($v3["comment"]);}?></td>
  </tr>
  <?php if($v3["link_img_upload"]!= null) {?>
  <tr style="background-color:#FEFEFE; ">
    <td style="padding-left:20px;">Attachement : <a href="<?php echo $v3["link_img_upload"]; ?>" target="_blank" >Click Here </a></td>
  </tr> 
  <?php }}?>
  </table>
  
------------------------------------------------------------------------------------------------------
<hr />

<form id="form2" name="form2" method="post" action="/rosteraudit/payroll-save-add-comm-admin">
	<input type="hidden" name="start_date" id="start_date" value="<?php echo $this->dateStart;?>" />
   	<input type="hidden" name="end_date" id = "end_date" value="<?php echo $this->dateEnd;?>" />
  <textarea name="comm_admin" id="comm_admin" rows="2" style="width:80%"></textarea>
  <br />
  <br />
  Staff Name: 
  <input type="text" name="staff_name_admin" id="staff_name_admin" /> 
  <input type="hidden" name="id_case" value="<?=$v["id_case"]?>" /> 
  <input name="btn_comment_admin" type="submit" value="Add Comment" />

</form>


</div>
</td>
<?php /*?>
<td>
<div id="light<?=$v["id_case"]?>" class="btn_edit">
      <div style=" background-color:#97C0FF; display:block">
		<span style="float:left">Edit</span> <span style="float:right;"><a class="modal_close" href="#">[ X ]</a></span><br />
		</div>
        <div style="background-color:#EEE; display:block; padding:"><br />
<form id = "form3" name = "form3" action = "/rosteraudit/accept-fake-attn-record" method = "post" enctype="multipart/form-data"> 
      <div class="con">
 	 <p>INSERT FAKE RECORD: For <?php $mgrDetail = $stDetail->getDetail($v['id_staff']);
	echo ucwords(($mgrDetail['ni']=="")?Model_EncryptHelper::getSslpassword($mgrDetail['n']):$mgrDetail['ni']);
		  $staffInfo = new Model_DbTable_Roster_Staffinfo();
    	  $staffPackage = $staffInfo->getStaffinfo($v['id_staff']);
    	  $package = $recShopList = unserialize(PAYROLL_TYPE);?>
    	<?php echo "Payment Type:".$package[$staffPackage['id_package']][0]?><br /><br />
   		 <input type="hidden" name="staff_id" id="staff_id" value="<?php echo $v['id_staff'];?>" />
   		 <input type="hidden" name="case_id" id = "case_id" value="<?php echo $v['id_case'];?>" />
   		 <input type="hidden" name="start_date" id="start_date" value="<?php echo $this->dateStart;?>" />
   		 <input type="hidden" name="end_date" id = "end_date" value="<?php echo $this->dateEnd;?>" />
    		<br />
   		 Shop Code: <input name="shop_code" type="text" value = "<?php echo $v['shop_code'];?>" />
  		<br />
  		<br />
  		<?php if(!$attRow[0]&&!$attRow[1]){?>
  	
   		 Date:
   		 <?php $date=explode('-',$v['shift_date']);?>
  		<input type="text" name="year" id="year" value="<?php echo $date[0]?>" style="width:50px;" /> 
   			 -
  		<input type="text" name="month" id="month" value="<?php echo $date[1]?>" style="width:50px;" />
    		 -
  <input type="text" name="day" id="day" value="<?php echo $date[2]?>" style="width:50px;" /> 
    (2013-09-09)<br />
  <br />
  On Duty <br/><br/>
    Time:
  <input type="hidden" name = "on_status" id = "on_status" value = "1"></input>
  <input type="text" name="hour" id="hour" value="<?php echo str_pad($v['man_shift_begin_hour'],2,"0",STR_PAD_LEFT);?>" style="width:50px;" /> 
    :
  <input type="text" name="min" id="min" value="<?php echo str_pad($v['man_shift_begin_min'],2,"0",STR_PAD_LEFT);?>" style="width:50px;" /> 
    (09:08),(17:59)<br />
  <br />
  Off Duty<br/><br/>
    Time:
  <input type="hidden" name = "off_status" id = "off_status" value = "1"></input>
  <input type="text" name="hour2" id="hour2" value="<?php echo str_pad($v['man_shift_end_hour'],2,"0",STR_PAD_LEFT);?>" style="width:50px;" /> 
    :
  <input type="text" name="min2" id="min2" value="<?php echo str_pad($v['man_shift_end_min'],2,"0",STR_PAD_LEFT);?>" style="width:50px;" /> 
    (09:08),(17:59)<br />
  <br />
		<?php }elseif(!$attRow[0]){?>
		 Date:
   		 <?php $date=explode('-',$v['shift_date']);?>
  		<input type="text" name="year" id="year" value="<?php echo $date[0]?>" style="width:50px;" /> 
   			 -
  		<input type="text" name="month" id="month" value="<?php echo $date[1]?>" style="width:50px;" />
    		 -
  <input type="text" name="day" id="day" value="<?php echo $date[2]?>" style="width:50px;" /> 
    (2013-09-09)<br />
  <br />
  On Duty <br/><br/>
    Time:
  <input type="hidden" name = "on_status" id = "on_status" value = "1"></input>
  <input type="hidden" name = "off_status" id = "off_status" value = "2"></input>
  <input type="text" name="hour" id="hour" value="<?php echo str_pad($v['man_shift_begin_hour'],2,"0",STR_PAD_LEFT);?>" style="width:50px;" /> 
    :
  <input type="text" name="min" id="min" value="<?php echo str_pad($v['man_shift_begin_min'],2,"0",STR_PAD_LEFT);?>" style="width:50px;" /> 
    (09:08),(17:59)<br />
  <br />
		
		<?php }else{?>
		Date:
   		 <?php $date=explode('-',$v['shift_date']);?>
  		<input type="text" name="year" id="year" value="<?php echo $date[0]?>" style="width:50px;" /> 
   			 -
  		<input type="text" name="month" id="month" value="<?php echo $date[1]?>" style="width:50px;" />
    		 -
  <input type="text" name="day" id="day" value="<?php echo $date[2]?>" style="width:50px;" /> 
    (2013-09-09)<br />
  <br />
  Off Duty<br/><br/>
    Time:
  <input type="hidden" name = "on_status" id = "on_status" value = "2"></input>
  <input type="hidden" name = "off_status" id = "status" value = "1"></input>
  <input type="text" name="hour2" id="hour2" value="<?php echo str_pad($v['man_shift_end_hour'],2,"0",STR_PAD_LEFT);?>" style="width:50px;" /> 
    :
  <input type="text" name="min2" id="min2" value="<?php echo str_pad($v['man_shift_end_min'],2,"0",STR_PAD_LEFT);?>" style="width:50px;" /> 
    (09:08),(17:59)<br />
  <br />
		<?php }?>
  <br />
  Input Head Office Staff Name: <input name="staff_name" type="text" /> <br /><br />
  I will process the payment on: <input name="pay_date" type="text" id="pay_date<?=$v["id_case"]?>" class = "date" value="" /><br />
  (YYYY-MM-DD)<br /><br />
  Comment:<br/>
  <textarea name="comment" style="width:80%" rows="2"></textarea><br />
  <br />
    <input type="submit" name="btn_insert" id="btn_insert" value="Accept Record" onclick="if(confirm('Are you sure to confirm this roster?')){} else {return false;};"></input>
    <br />

<br />
  </p>
      </div>
</form>
</div>     
</div>
</td>
<?php */?>
</tr>  

<?php }} ?>  
  
  
</table>




<h2>Payment Pending Case ( Not current payroll week )</h2>
<table width="1300" border="0" cellspacing="0" cellpadding="0" style="font-size:12px;">
  <tr>
    <th scope="col" rowspan="2" align="center">Case ID</th>
    <th scope="col" rowspan="2" align="center">Shop</th>
    <th scope="col" rowspan="2" align="center">Manager</th>
    <th scope="col"  rowspan="2" align="center">Staff</th>
    <th scope="col"  rowspan="2" align="center">Payment Method</th>
    <th scope="col" rowspan="2" align="center">Claim Date</th>
    <th scope="col" rowspan="2" align="center">Allocated Hours</th>
    <th scope="col" rowspan="2" align="center">Paid Hours</th>
    <th scope="col" rowspan="2" align="center">Short Hours</th>
    <th colspan="5"  align="center" scope="col">PayHour Detail</th>
    <th scope="col"  rowspan="2" align="center">Pay Date</th>
    <th scope="col" rowspan="2" align="center">Action</th>
  </tr>
  <tr>
    <td align="center" style="width:50px">Normal</td>
    <td align="center" style="width:50px">Aft 6PM</td>
    <td align="center" style="width:50px">Sat</td>
    <td align="center" style="width:50px">Sun</td>
    <td align="center" style="width:50px">Holiday</td>
  </tr>
  
<?php
if(!empty($this->waitCase)){
foreach($this->waitCase as $v2){
?>  
  <tr>
    <td><a id="txt<?=$v2["id_case"]?>" href="javascript:toggle2('dX<?=$v2["id_case"]?>','<?=$v2["id_case"]?>','txt<?=$v2['case_id_case']?>');"><?php echo $v2['case_id_case']?></a></td>
    <td><?php echo $v2['shop_code']?></td>
    <td><?php 
    $mgrDetail = $stDetail->getDetail($v2['id_manager']);
    echo ($mgrDetail['ni']=="")?Model_EncryptHelper::getSslpassword($mgrDetail['n']):$mgrDetail['ni'];
    ?></td>
    <td><?php 
    $mgrDetail = $stDetail->getDetail($v2['id_staff']);
    echo ($mgrDetail['ni']=="")?Model_EncryptHelper::getSslpassword($mgrDetail['n']):$mgrDetail['ni'];
    ?></td>
    <?php $staffInfo = new Model_DbTable_Roster_Staffinfo();
    	  $staffPackage = $staffInfo->getStaffinfo($v2['id_staff']);
    	  $package = $recShopList = unserialize(PAYROLL_TYPE);?>
    <td><?php echo $package[$staffPackage['id_package']][0]?></td>
    <td><?php echo $v2['shift_date']?></td>
    <td><?php echo $v2['hour_request']?></td>
    <td><?php echo $v2['hour_allocate']?></td>
    <td><?php echo $v2['hour_request'] - $v2['hour_allocate'] ?></td>
    <td><?php echo $v2['hour_allocate_normal']?></td>
    <td><?php echo $v2['hour_allocate_6pm']?></td>
    <td><?php echo $v2['hour_allocate_sat']?></td>
    <td><?php echo $v2['hour_allocate_sun']?></td>
    <td><?php echo $v2['hour_allocate_pholiday']?></td>
    <td><?php echo $v2['pay_on']?></td>
    <td><table width="100%" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td align="center">
        <a id="go" rel="leanModal" name="request" href="#btn_exp<?=$v2["id_case"]?>">Export</a>
        <div id="btn_exp<?=$v2["id_case"]?>" class="btn_com">        
		<div style=" background-color:#97C0FF; display:block">
		<span style="float:left">Export</span> <span style="float:right;"><a class="modal_close" href="#">[ X ]</a></span><br />
		</div>
        <div style="background-color:#EEE; display:block"><br />

        <form action="/rosteraudit/payroll-save-export" method="post">
        You are about to export the time sheet for this page, after you done this, we will consider this one is in Paid Condition
        <br />
		<input type="hidden" name="start_date" id="start_date" value="<?php echo $this->dateStart;?>" />
   		<input type="hidden" name="end_date" id = "end_date" value="<?php echo $this->dateEnd;?>" />
		Input Head Office Staff Name: <input name="staff_name" type="text" /> <br /><br />
        <input type="hidden" name="id_case" value="<?=$v2["id_case"]?>" />
        <input name="btn_export" type="submit" value="Export Time Sheet" />
        </form>
        <br />
        </div>
</div>
        
        
        </td>
        <td align="center">
         <a id="go" rel="leanModal" name="request" href="#btn_delay<?=$v2["id_case"]?>">Delay</a>
        <div id="btn_delay<?=$v2["id_case"]?>" class="btn_com">        
		<div style=" background-color:#97C0FF; display:block">
		<span style="float:left">Delay Payment</span> <span style="float:right;"><a class="modal_close" href="#">[ X ]</a></span><br />
		</div>
        <div style="background-color:#EEE; display:block"><br />

        <form action="/rosteraudit/payroll-save-delay" method="post">
        I have reason to Delay This Payment to The following Date for the following Reason
        <br />
		<input type="hidden" name="start_date" id="start_date" value="<?php echo $this->dateStart;?>" />
   		<input type="hidden" name="end_date" id = "end_date" value="<?php echo $this->dateEnd;?>" />
		Input Head Office Staff Name: <input name="staff_name" type="text" /> <br /><br />
        Delay To :<input name="date_will_pay" type="text" id="date_will_pay" class = "date" value="" /><br />
<br />

		Reason / Delay The Payment
		<textarea name="comment" style="width:80%" rows="2"></textarea><br />

        <input type="hidden" name="id_case" value="<?=$v2["id_case"]?>" />
		
        <input name="btn_delay" type="submit" value="Delay Payment" />
        </form>
        <br />
        </div>
</div>
    
       
        </td>
        <td align="center">
         <a id="go" rel="leanModal" name="request" href="#btn_rej<?=$v2["id_case"]?>">Reject</a>
        <div id="btn_rej<?=$v2["id_case"]?>" class="btn_com">        
		<div style=" background-color:#97C0FF; display:block">
		<span style="float:left">Rejection</span> <span style="float:right;"><a class="modal_close" href="#">[ X ]</a></span><br />
		</div>
        <div style="background-color:#EEE; display:block"><br />

        <form action="/rosteraudit/payroll-save-reject" method="post">
        <input type="hidden" name="start_date" id="start_date" value="<?php echo $this->dateStart;?>" />
   		<input type="hidden" name="end_date" id = "end_date" value="<?php echo $this->dateEnd;?>" />
        The Evidence provided is not good enough For me to make "Accept Case" Decision. <br /><br />
		There will be no more proofs,payment will NOT be processed.<br />
<br />

		Input Head Office Staff Name: <input name="staff_name" type="text" /> <br /><br />
		Reason / Comment Of Reject Case
		<textarea name="comment" style="width:80%" rows="2"></textarea><br />

        <input type="hidden" name="id_case" value="<?=$v2["id_case"]?>" />
		
        <input name="btn_rej" type="submit" value="Reject It!" />
        </form>
        <br />
        </div>
</div>
    
   
        
        
        </td>
      </tr>
    </table></td>
  </tr>
  
  <tr>
	<td colspan="22" style="padding:0px;">
	<div id="dX<?=$v2["id_case"]?>" style="display:none;" >

	<h3>Reasons Why can Not Provide Footage:</h3>
	<div>
	<?php echo $v2['reason_comment']?>
	</div>
	<h3>Detail Explainations:</h3>
	<div>
	<?php echo $v2['detail_explain']?>
	</div>
	<?php $acRecord = new Model_DbTable_Roster_Attcaserecord();
	$recordDetail = $acRecord->getAttcaserecordByCase($v2["id_case"]);?>
	<h3>Approve Staff: <?php echo $recordDetail['staff_name'];?> Date: <?php echo $recordDetail['date_change'];?></h3>
	<div>
	<?php echo $recordDetail['staff_name'];?> <?php echo $recordDetail['date_change'];?>
	</div>
	<h3>Comment &amp; Conversion</h3>
	<div>
	<?php echo $recordDetail['comment'];?>
	</div>	
	
	<hr/>
	</div>
	</td>
	</tr>
<?php }}?>
</table>
<p>Click <a href="/ACDF_Shortpayment<?php echo Model_DatetimeHelper::dateToday("");?>.txt" target="_blank">Here(BANK)</a> / <a href="/BE_Shortpayment<?php echo Model_DatetimeHelper::dateToday("");?>.txt" target="_blank">Here(CASH)</a> for Today's Exported Time Sheet, You should only do it &quot;ONCE A DAY&quot;</p>

<h2>Rejected by HQ/Canceled by Manager Case History</h2> 
<form id = 'form4' action = "" method = "post" enctype="multipart/form-data">
Begin Date:<input type = 'text' name = 'begin_date' id = 'begin_date'></input> End Date:<input type = 'text' name = 'finish_date' id = 'finish_date'></input>
<input type = "submit" name = 'change_date' id = 'change_date' value = "change"></input>
</form>
<br/><br/>
<table width="1300" border="0" cellspacing="0" cellpadding="0" style="font-size:12px;">
  <tr>
    <th scope="col" align="center">Case ID</th>
    <th scope="col" align="center">Shop</th>
    <th scope="col" align="center">Manager</th>
    <th scope="col" align="center">Staff</th>
    <th scope="col" align="center">Claim Date</th>
    <th scope="col" align="center">Allocated Hours</th>
    <th scope="col" align="center">Paid Hours</th>
    <th scope="col" align="center">Short Hours</th>
    <th  align="center" scope="col">Reject Date</th>
    <th  align="center" scope="col">Reject Comment</th>
  </tr>
  <?php
  if(!empty($this->rejectCase)){
foreach($this->rejectCase as $v3){
	//2014-08-15
	?>
  <tr>
    <td><a id="txt<?=$v3["id_case"]?>" href="javascript:toggle2('dX<?=$v3["id_case"]?>','<?=$v3["id_case"]?>','txt<?=$v3['case_id_case']?>');"><?php echo $v3['case_id_case']?></a></td>
    <td><?php echo $v3['shop_code']?></td>
    <td><?php 
    $mgrDetail = $stDetail->getDetail($v3['id_manager']);
    echo ($mgrDetail['ni']=="")?Model_EncryptHelper::getSslpassword($mgrDetail['n']):$mgrDetail['ni'];
    ?></td>
    <td><?php 
    $mgrDetail = $stDetail->getDetail($v3['id_staff']);
    echo ($mgrDetail['ni']=="")?Model_EncryptHelper::getSslpassword($mgrDetail['n']):$mgrDetail['ni'];
    ?></td>
    <td><?php echo $v3['shift_date']?></td>
    <td><?php echo $v3['hour_request']?></td>
    <td><?php echo $v3['hour_allocate']?></td>
    <td><?php echo $v3['hour_request'] - $v3['hour_allocate'] ?></td>
    <td><?php echo $v3['dicision_date']?></td>
    <td><?php 
	$comm = $attCaseRecord->rejectComment($v3['id_case']);
	
	echo $comm; 

	?></td>
  </tr>
  <tr>
	<td colspan="22" style="padding:0px;">
	<div id="dX<?=$v3["id_case"]?>" style="display:none;" >

	<h3>Reasons Why can Not Provide Footage:</h3>
	<div>
	<?php echo $v3['reason_comment']?>
	</div>
	<h3>Detail Explainations:</h3>
	<div>
	<?php echo $v3['detail_explain']?>
	</div>
	<?php $acRecord = new Model_DbTable_Roster_Attcaserecord();
	$recordDetail = $acRecord->getAttcaserecordByCase($v3["id_case"]);?>
	<h3>Approve Staff/Date</h3>
	<div>
	<?php echo $recordDetail['staff_name'];?> <?php echo $recordDetail['date_change'];?>
	</div>
	<h3>Comment &amp; Conversion</h3>
	<div>
	<?php echo $recordDetail['comment'];?>
	</div>	
	
	<hr/>
	</div>
	</td>
	</tr>
  
  <?php }}?>
</table>
<h2>Closed Case History</h2>
<form id = 'form4' action = "" method = "post" enctype="multipart/form-data">
Begin Date:<input type = 'text' name = 'begin_date2' id = 'begin_date2'></input> End Date:<input type = 'text' name = 'finish_date2' id = 'finish_date2'></input>
<input type = "submit" name = 'change_date2' id = 'change_date2' value = "change"></input><br/><br/>
</form>
<table width="1300" border="0" cellspacing="0" cellpadding="0" style="font-size:12px;">
  <tr>
    <th scope="col" rowspan="2" align="center">Case ID</th>
    <th scope="col" rowspan="2" align="center">Shop</th>
    <th scope="col" rowspan="2" align="center">Manager</th>
    <th scope="col" rowspan="2" align="center">Staff</th>
    <th scope="col" rowspan="2" align="center">Type</th>
    <th scope="col" rowspan="2" align="center">Claim Date</th>
    <th scope="col" rowspan="2" align="center">Allocated Hours</th>
    <th scope="col" rowspan="2" align="center">Paid Hours</th>
    <th scope="col" rowspan="2" align="center">Short Hours</th>
    <th colspan="4"  align="center" scope="col">PayHour Detail</th>
    <th scope="col"  rowspan="2" align="center">Paid Date<br/>(YYYY-MM-DD)</th>
    <th scope="col"  rowspan="2" align="center">cheque No</th>
  </tr>
  <tr>
    <td align="center" style="width:50px">Normal</td>
    <td align="center" style="width:50px">Aft 6PM</td>
    <td align="center" style="width:50px">Sat</td>
    <td align="center" style="width:50px">Sun</td>
  </tr>
  <?php
  if(!empty($this->paidCase)){
foreach($this->paidCase as $v4){
	//2014-08-15
	$staffPackage = $staffInfo->getStaffinfo($v4['id_staff']);
	    	  $package = $recShopList = unserialize(PAYROLL_TYPE);?>
  <tr>
  		
    <td><a id="txt<?=$v4["id_case"]?>" href="javascript:toggle2('dX<?=$v4["id_case"]?>','<?=$v4["id_case"]?>','txt<?=$v4['case_id_case']?>');"><?php echo $v4['case_id_case']?></a></td>
    <td><?php echo $v4['shop_code']?></td>
    <td><?php 
    $mgrDetail = $stDetail->getDetail($v4['id_manager']);
    echo ($mgrDetail['ni']=="")?Model_EncryptHelper::getSslpassword($mgrDetail['n']):$mgrDetail['ni'];
    ?></td>
    <td><?php 
    $mgrDetail = $stDetail->getDetail($v4['id_staff']);
    echo ($mgrDetail['ni']=="")?Model_EncryptHelper::getSslpassword($mgrDetail['n']):$mgrDetail['ni'];
    ?></td>
    <td><?php echo $package[$staffPackage['id_package']][0]?></td>
    <td><?php echo $v4['shift_date']?></td>
    <td><?php echo $v4['hour_request']?></td>
    <td><?php echo $v4['hour_allocate']?></td>
    <td><?php echo $v4['hour_request'] - $v4['hour_allocate'] ?></td>
    <td><?php echo $v4['hour_allocate_normal']?></td>
    <td><?php echo $v4['hour_allocate_6pm']?></td>
    <td><?php echo $v4['hour_allocate_sat']?></td>
    <td><?php echo $v4['hour_allocate_sun']?></td>
    <td><?php echo $v4['pay_on']?></td>
    <td>
    <?php 
	if($v4['cheque_no']!=""){
		echo $v4['cheque_no'];
		}
	else{
	?>	
	<a id="go" rel="leanModal" name="request" href="#btn_cheq<?=$v4["id_case"]?>">Upload Cheque No</a>
        <div id="btn_cheq<?=$v4["id_case"]?>" class="btn_com">        
		<div style=" background-color:#97C0FF; display:block">
		<span style="float:left">Upload Cheque No</span> <span style="float:right;"><a class="modal_close" href="#">[ X ]</a></span><br />
		</div>
        <div style="background-color:#EEE; display:block"><br />

        <form action="/rosteraudit/payroll-save-cheque" method="post">
        You are about to upload the cheque no from MYOB, This is the Final Step, After Cheque No Upload, Case is Closed and will disappear in the list in 30 days
        <br />
		<input type="hidden" name="start_date" id="start_date" value="<?php echo $this->dateStart;?>" />
   		<input type="hidden" name="end_date" id = "end_date" value="<?php echo $this->dateEnd;?>" />
		Input Head Office Staff Name: <input name="staff_name" type="text" /> <br /><br />
        Cheque No in Myob: <input name="cheque_no" type="text" />
        <input type="hidden" name="id_case" value="<?=$v4["id_case"]?>" />
        <input name="btn_che" type="submit" value="Record Cheque No" />
        </form>
        <br />
        </div>
</div>
    
    <?php	
	}	
	?>
    </td>
  </tr>
  
  <tr>
	<td colspan="22" style="padding:0px;">
	<div id="dX<?=$v4["id_case"]?>" style="display:none;" >

	<h3>Reasons Why can Not Provide Footage:</h3>
	<div>
	<?php echo $v4['reason_comment']?>
	</div>
	<h3>Detail Explainations:</h3>
	<div>
	<?php echo $v4['detail_explain']?>
	</div>
	<?php $acRecord = new Model_DbTable_Roster_Attcaserecord();
	$recordDetail = $acRecord->getAttcaserecordByCase($v4["id_case"]);?>
	<h3>Approve Staff: <?php echo $recordDetail['staff_name'];?> Date: <?php echo $recordDetail['date_change'];?></h3>
	<h3>Comment &amp; Conversion</h3>
	<div>
	<?php echo $recordDetail['comment'];?>
	</div>	
	
	<hr/>
	</div>
	</td>
	</tr>
  <?php }}?>
</table>
<br/>
<div id = "payrollWizard" <?php if(!$this->nextCheck){?>style = "visibility:hidden;<?php }?>">
<input type = "submit" name = "next" id = "next" value = "Next" onclick= "transfer('<?php echo $this->dateStart;?>','<?php echo $this->dateEnd;?>')"></input>
</div>


<script language="javascript" >

$(document).ready(function() {
	
	$('input[id^="cald"]').change(function(){
		
	var startHour =  parseFloat($("#cald_start_hour").val()); 
	var startMin =  parseFloat($("#cald_start_min").val());
	var endHour =  parseFloat($("#cald_end_hour").val());
	var	endMin =  parseFloat($("#cald_end_min").val());
	var totalHour = 0;
	totalHour = Math.round(((endHour - startHour) + (endMin-startMin)/60 ) * 100 )/100;
	$("#calh_total_hour").val(totalHour.toFixed(2));		
		});
	$('input[id^="calh"]').change(function(){
		var hour1 = parseFloat($("#calh_total_hour").val());
		var hour2 = parseFloat($("#calh_hour_2").val());
		var sumHour = 0;
		sumHour = hour1 + hour2;
		//alert(sumHour);
		$("#calh_hour_sum").val(sumHour.toFixed(2));
		});	
		
		
});
  </script>
</body>
</html>
